User blog:Rich Varney/Week 4 - Mastering Time
There are an overwhelming number of references to time within "Alice's Adventures in Wonderland". Einstein's theory of General Relativity explains gravity beginning with the notion that time is not constant. What better way to explore these concepts than by manipulating clocks? While digital or analogue clocks could be rendered to a screen, a physical analogue clock has a "real" quality that would be far more effective in conveying the manipulation of time. I had some clock mechanisms (these are a common item used by woodturners) lying around at home and decided to experiment to see if it would be possible to control the mechanism from an Arduino. The idea to achieve this, was to wire directly on to the solenoid bypassing the battery and quartz electronics on the clock. Under normal circumstances the electromagnet that this solenoid is part of drives a cog containing a magnet through the current supplied to the solenoid alternating at one second intervals. The magnetism makes the cog move back and forth and in turn drives the other cogs within the clock to drive the three hands. The theory was that by changing this interval at which the current is alternated the clock could be sped up or slowed down. The first task was to dismantle the clock mechanism. This was pretty easy. After removing the hands and detaching the clock mechanism the first problem occurred as soon as the back was removed from the mechanism. The back was clearly holding some of the cogs in place and removing it resulted in a soup of misplaced plastic discs. It took some time to discover the correct positions of all of the pieces so that I could be confident of reassembling it before. Wiring to the solenoid was simply a case of soldering to two joints. Reassembly was fiddly at first but by the time I had done the third clock it proved relatively straightforward. The hardest thing was keeping the delicately balanced cogs in place while re-attaching the cover. With the rewiring of the clock complete it was now time to test the change. The wires were connected to two digital pins of an Arduino and the code below was simply used within the loop function to alternate the current to the solenoid. if (int(millis()/1000 )%2) { digitalWrite(CLOCKa, LOW); digitalWrite(CLOCKb, HIGH); } else { digitalWrite(CLOCKb, LOW); digitalWrite(CLOCKa, HIGH); } This worked first time and the clock ticked at one second intervals, by changing the value by which the result of millis() is divided the clock can be sped up or slowed down. There are limits to this - a value of 20ms (i.e. a clock running at 50 times speed) as as fast as the clock can move. At rates faster than this the cogs cannot move far enough in the time available to engage and cause the hand to move. At very low intervals also the hands may move forward or backwards. The direction in which the hands start to spin at these speeds seem dependent on momentum and are thus hard to control. Some frequencies between 50ms and 400ms seem to cause the mechanism to move backwards and forwards at random. Therefore it is likely that frequencies that suit each different clock mechanism will need to be found. One idea for using this is to have a display of three clocks running with each running at a slightly different rate - e.g. 0.95s, 1s and 1.05s. The challenge to the user is to detect which clock is the correct one. The pictured prototype is the first attempt at achieving this. More experimentation is required to find rates that are challenging, but not impossible to detect. It will also be interesting to see if users can be fooled through the use of ticking sounds or flashing LEDs tuned to one of the wrong clocks. Category:Blog posts Category:Blog posts